<template>
  <div class="cardslot" :style="{ width: width }">
    <div v-if="isTitle" class="card_title">
      <div class="card_title_left">
        <!-- <img src="@/assets/images/ico_title_left.png" alt="" /> -->
        <img src="@/assets/images/ico_title_top.png" alt="" />
        <div>{{ title }}</div>
      </div>
      <div v-if="slotShow" class="card_header">
        <slot name="header" />
      </div>
      <div v-if="moreShow" class="card_more">
        <slot name="more" />
      </div>
    </div>
    <div
      class="card_content"
      :style="{
        height: titleHeight ? 'calc(100% - ' + temoHeight + 'px)' : '100%'
      }"
    >
      <slot />
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  title: {
    type: String,
    default: ""
  },
  width: {
    type: String,
    default: ""
  },
  slotShow: {
    type: Boolean,
    default: false
  },
  moreShow: {
    type: Boolean,
    default: false
  },
  isTitle: {
    type: Boolean,
    default: true
  }
});

let titleHeight = props.isTitle;
let temoHeight = 39;
</script>

<style scoped lang="scss">
.cardslot {
  margin-bottom: 20px;
  // width: 471px;
  // background-image: url("@/assets/images/img_item_bg.png");
  // background-repeat: no-repeat;
  // background-position: center;
  // background-size: 100% 100%;
  background-color: rgba($color: #fff, $alpha: 0.75);
  border: 1px solid rgba($color: #ccc, $alpha: 0.72);

  .card_title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: var(--temoHeight);
    // padding: 9px 8px 15px;
    padding: 9px 8px;
    font-size: 18px;
    font-weight: bold;
    line-height: 17px;
    color: #333;
    // background-image: url("@/assets/images/img_title_bg.png");
    background-image: url("@/assets/images/img_title_bg_red.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;

    img {
      width: 16px;
      height: 16px;
      margin-right: 10px;
    }

    .card_title_left {
      // display: flex;
      // align-items: center;

      display: flex;
      flex-direction: column;

      img {
        width: 2em;
        height: 100%;
      }

      div {
        padding-top: 5px;
      }
    }

    .card_more {
      font-size: 14px;
      list-style: 14px;
      cursor: pointer;
    }
  }

  .card_content {
    width: 100%;
    padding: 10px;
  }
}
</style>
